<%@ page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="java.util.List"%><%@page import="java.util.Map"%>

<%@ include file="../common/commonJS.jsp" %>
<%@ include file="../common/commonLabel.jsp" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>客户信息列表</title>
</head>
<script type="text/javascript">
function selectGoods(cid){

	if(confirm("确定选择该原材料吗？")){
		orderAjax.getStockByGoodsid(cid,function(s){
			var ips = parent.nowStock.all.tags("INPUT");
			for (var i=0; i<ips.length; i++) {
				if(ips[i].name!=null&&ips[i].name!=""){
				  	if(ips[i].name=='tgoodsid'){
				  		ips[i].value=s.goodsid;
				  	}
				  	if(ips[i].name=='goodsname'){
				  		ips[i].value=s.goodsname;
				  	}
				  	
				  	if(ips[i].name=='goodstype'){
				  		ips[i].value=s.goodstype;
				  	}
				  	if(ips[i].name=='goodsstandard'){
				  		ips[i].value=s.standard;
				  	}	
				  	if(ips[i].name=='numreal'){
				  		ips[i].value=s.numreal;
				  	}	
				}
			}
			doclose();
		});
	}
	
}

function insNew(){
	window.parent.location.href='<%=request.getContextPath()%>/markings.action';
}
</script>
<body>
<table width="500" border="0" cellpadding="0" cellspacing="0" >
  <tr>
     <td>
     <table width="50%" height="100%" border="0" cellspacing="0" cellpadding="0" class="MainBody">
      <tr>
        <td class="MainBody_title">库存信息</td>
      </tr>
      <tr>
        <td class="MainBody_body" >
       <input name="toIns" value="添加" type="button" class="btn" onclick="insNew()"/>
       <font color="red">* 当前选择库存为【<%=request.getAttribute("source")+"库" %>】   没有你想要的原材料信息？请点击【添加】</font>
        <table border="0" cellpadding="0" cellspacing="0"  class="MainBody_table">
           <tr>
				<th nowrap="nowrap" width="30">序号</th>
				<th nowrap="nowrap" width="80">原料名称</th>
				<th nowrap="nowrap" width="80">类型</th>
				<th nowrap="nowrap" width="150">规格</th>
				<th nowrap="nowrap" width="150">当前库存量</th>
				<th nowrap="nowrap" width="150">实际可用数量</th>
				<th nowrap="nowrap" width="60">操作</th>
			</tr>

             	<% 
             	  if(request.getAttribute("list")!=null){
             		List list = (List)request.getAttribute("list");
             		for(int i=0;i<list.size();i++){
             			Map c = (Map)list.get(i);
             	 %>
			<tr>
				<td align="center" nowrap="nowrap"><%=i+1 %></td>
				<td align="center" nowrap="nowrap"><a href="#" onclick="return selectGoods('<%=c.get("goodsid")%>')" title="选择原材料"><%=c.get("goodsname") %></a></td>
				<td align="center" nowrap="nowrap"><%=c.get("goodstype") %></td>
				<td align="center" nowrap="nowrap"><%=c.get("standard") %></td>
				<td align="center" nowrap="nowrap"><%=c.get("numnow") %></td>
				<td align="center" nowrap="nowrap"><%=c.get("numreal") %></td>
				<td align="center" nowrap="nowrap">
				<a href="#" title="选择原材料" onclick = "return selectGoods('<%=c.get("goodsid")%>')">[选择]</a>
				</td> 
			</tr>
			<%}//for end
             }else{%>
		<tr>
			<td align="center" colspan="6">暂时没有您可以浏览的数据</td>
		</tr>
			<%
				} %>
          </table>
          <table border="0" cellpadding="0" cellspacing="0" class="MainBody_fun">
            <tr>
              <td>
               <hello:AllPage />
			  </td>
            </tr>
          </table>
          </td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>